package com.atguigu.gulimall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @Author 小坏
 * @Date 2020/11/5 13:46
 * @Version 1.0
 * @program: 父工程 gulimall 万物起源之地
 *
 * MyRedissonConfig
 */


@Configuration
public class MyRedisConfig {

    @Bean(destroyMethod = "shutdown")
    RedissonClient redisson() throws IOException {
        // 默认连接地址 127.0.0.1:6379
        Config config = new Config();
        config.useSingleServer().setAddress("redis://redis.uexpo.cn:6379").setPassword("103658").setDatabase(0);
//        config.useSingleServer().setAddress("redis://192.168.7.110:6378").setPassword("uexpo@hxx").setDatabase(0);
        RedissonClient redisson = Redisson.create(config);
        return redisson;
    }

}
